package com.manyan.demo.aspect;

import com.manyan.demo.config.DataSourceType;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

/**
 * 注入
 */
//@Aspect
//@Component
public class DataSourceAop {
    //在primary方法前执行
    /*@Before("execution(* com.mymanyan.demo.mapper.PrimaryCarMapper.*())")
    public void setDataSource2test01() {
        System.err.println("Primary业务");
        DataSourceType.setDataBaseType(DataSourceType.DataBaseType.Primary);
    }

    //在secondary方法前执行
    @Before("execution(* com.mymanyan.demo.mapper.SecondaryCarMapper.*())")
    public void setDataSource2test02() {
        System.err.println("Secondary业务");
        DataSourceType.setDataBaseType(DataSourceType.DataBaseType.Secondary);
    }*/
}